<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">




<title>值类型和引用类型的区别 - Autumoon - 博客园</title>
<meta name="keywords" content=".NET程序员技术面试迷你手册,C#版,值类型和引用类型的区别">



<link title="RSS" type="application/rss+xml" rel="alternate" href="http://www.cnblogs.com/Autumoon/rss">
<link title="RSD" type="application/rsd+xml" rel="EditURI" href="http://www.cnblogs.com/Autumoon/rsd.xml"> 
  



<link rel="stylesheet" type="text/css" href="index.css" media="all">
</head>
<body>
    <form name="Form1" method="post" action="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html" id="Form1">
<div>
<input name="__VIEWSTATE" id="__VIEWSTATE" value="" type="hidden">
</div>

        
<!--done-->
<div id="home">
<div id="header">
	<div id="blogTitle">
		
<!--done-->
<h1><a id="Header1_HeaderTitle" class="headermaintitle" href="http://www.cnblogs.com/Autumoon/">Autumoon</a></h1>
<h2><a href="http://www.autumoon.com/" target="_top" title="欢迎访问Autumoon Lab！">www.Autumoon.com</a></h2>



		
	</div><!--end: blogTitle 博客的标题和副标题 -->
	<div id="navigator">
		
<!--done-->
			<ul id="navList">
				<li></li>
				<li></li>
				<li><a href="http://home.cnblogs.com/">主页</a></li>
				<li><a href="http://home.cnblogs.com/ing/">闪存</a></li>				
				<li></li>
				<li><a id="MyLinks1_ContactLink" accesskey="9" class="menu" href="http://space.cnblogs.com/msg/send/Autumoon">联系</a></li>
				<li><a id="MyLinks1_Admin" class="menu" href="http://www.cnblogs.com/Autumoon/admin/EditPosts.aspx">管理</a></li>
				<li><a id="MyLinks1_Syndication" class="menu" href="http://www.cnblogs.com/Autumoon/rss">订阅</a>
				<a id="MyLinks1_XMLLink" class="aHeaderXML" href="http://www.cnblogs.com/Autumoon/rss"><img src="rss.gif" alt="订阅" style="border-width: 0px;"></a></li>
			</ul>


		<div class="blogStats">
			
			
<!--done-->
随笔-71&nbsp;
文章-0&nbsp;
评论-326&nbsp;

			
		</div><!--end: blogStats -->
	</div><!--end: navigator 博客导航栏 -->
</div><!--end: header 头部 -->
<div id="main">
	<div id="mainContent">
	<div class="forFlow">
		
					
<!--done-->
<div id="topics">
	<div class="post">
		<h1 class="postTitle">
			<a id="ctl04_TitleUrl" class="postTitle2" href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html">值类型和引用类型的区别</a>
		</h1>
		<div class="clear"></div>
		<div class="postBody">
			<p><font size="2"><a href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270520.html">【回目录】</a></font></p>
<p><font size="2">似乎“值类型和引用类型的区别”是今年面试的流行趋势，我已然是连续三次（目前总共也就三次）面试第一个问题就遇到这个了，这是多大的概率啊，100%，哈哈，我该买彩票去！</font></p>
<p><font size="2">言归正传，咱还是先来探讨探讨这二者之间有什么区别吧。记得有一次电话面试中，我直接跟面试官说：“值类型是现金，引用类型是存折”，后来想想当时说这话虽是有点儿冲动地脱口而出，但也没什么不妥。我这人不善于背理论的教条，喜欢把书本上那些生硬的话跟现实生活中常见的事物联系起来理解和记忆。</font></p>
<p><font size="2">直白点儿说：值类型就是现金，要用直接用；引用类型是存折，要用还得先去银行取现。</font></p>
<p><font size="2">声明一个值类型变量，编译器会在栈上分配一个空间，这个空间对应着该值类型变量，空间里存储的就是该变量的值。引用类型的实例分配在堆上，新建一个引用类型实例，得到的变量值对应的是该实例的内存分配地址，这就像您的银行账号一样。具体哪些类型是值类型哪些是引用类型，大家翻翻书，背一背就好了，不过我想，做过一段时间的开发，即使您背不了书上教条的定义，也不会把值类型和引用类型搞混的。接下来，还是老规矩，咱看码说话吧。</font></p>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">   1:</span> <span style="color: rgb(0, 0, 255);">public</span> <span style="color: rgb(0, 0, 255);">class</span> Person</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">   2:</span> {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">   3:</span>     <span style="color: rgb(0, 0, 255);">public</span> <span style="color: rgb(0, 0, 255);">string</span> Name { get; set; }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">   4:</span>     <span style="color: rgb(0, 0, 255);">public</span> <span style="color: rgb(0, 0, 255);">int</span> Age { get; set; }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">   5:</span> }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">   6:</span>&nbsp; </pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">   7:</span> <span style="color: rgb(0, 0, 255);">public</span> <span style="color: rgb(0, 0, 255);">static</span> <span style="color: rgb(0, 0, 255);">class</span> ReferenceAndValue</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">   8:</span> {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">   9:</span>     <span style="color: rgb(0, 0, 255);">public</span> <span style="color: rgb(0, 0, 255);">static</span> <span style="color: rgb(0, 0, 255);">void</span> Demonstration()</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">  10:</span>     {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">  11:</span>         Person zerocool = <span style="color: rgb(0, 0, 255);">new</span> Person { Name = <span style="color: rgb(0, 96, 128);">"ZeroCool"</span>, Age = 25 };</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">  12:</span>         Person anders = <span style="color: rgb(0, 0, 255);">new</span> Person { Name = <span style="color: rgb(0, 96, 128);">"Anders"</span>, Age = 47 };</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">  13:</span>&nbsp; </pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">  14:</span>         <span style="color: rgb(0, 0, 255);">int</span> age = zerocool.Age;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">  15:</span>         zerocool.Age = 22;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">  16:</span>&nbsp; </pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">  17:</span>         Person guru = anders;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">  18:</span>         anders.Name = <span style="color: rgb(0, 96, 128);">"Anders  Hejlsberg"</span>;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">  19:</span>&nbsp; </pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">  20:</span>         Console.WriteLine(<span style="color: rgb(0, 96, 128);">"zerocool's age:\t{0}"</span>, zerocool.Age);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">  21:</span>         Console.WriteLine(<span style="color: rgb(0, 96, 128);">"age's value:\t{0}"</span>, age);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">  22:</span>         Console.WriteLine(<span style="color: rgb(0, 96, 128);">"anders' name:\t{0}"</span>, anders.Name);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">  23:</span>         Console.WriteLine(<span style="color: rgb(0, 96, 128);">"guru' name:\t{0}"</span>, guru.Name);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">  24:</span>     }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">  25:</span> }</pre>
</div>
</div>
<p><font size="2">上面这段代码，我们首先创建了一个Person类，包含了Name和Age两个属性，毋庸置疑，Person类是引用类型，Name也是，因为它是string类型的（但string是很特殊的引用类型，后面将专门有一篇文章来讨论），但Age则是值类型。接下来我们来看看Demonstration方法，其中演示的就是值类型跟引用类型的区别。</font></p>
<p><font size="2">首先，我们声明了两个Person类的实例对象，zerocool和anders，前面提到过，这两个对象都被分配在堆上，而zerocool和anders本身其实只是对象所在内存区域的起始地址引用，换句话说就是指向这里的指针。我们声明对象实例时也顺便分别进行了初始化，首先我们看，zerocool对象的值类型成员，我们赋值为25（对，我今年25岁），anders（待会儿你们就知道是谁了）的Name属性，我们赋值为“Anders”。齐活儿，接下来看我们怎么干吧。</font></p>
<p><font size="2">我们声明一个值类型变量age，直接在初始化时把zerocool的Age值赋给它，显然，age的值就是25了。但这个时候zerocool不高兴了，他想装嫩，私自把自己的年龄改成22岁，刚够法定结婚年龄。然后我们又声明了一个引用类型的guy对象，初始化时就把anders赋给它，然后anders露出庐山真面目了，他的名字叫“Anders Hejlsberg”（在此向C#之父致敬）。接下来我们来分别答应出这几个变量的值，看看有什么差别。</font></p>
<p><font size="2"><img title="Result01" style="border-width: 0px;" alt="Result01" src="result01_3.png" border="0" height="277" width="473"> </font></p>
<p><font size="2">你可能要觉得奇怪（你要不觉得奇怪，也就不用再接着往下看了），为什么我们改了zerocool.Age的值，age没跟着变，改了anders.Name的值，guru.Name却跟着变了呢？这就是值类型和引用类型的区别。我们声明age值类型变量，并将zerocool.Age赋给它，编译器在栈上分配了一块空间，然后把zerocool.Age的值填进去，仅此而已，二者并无任何牵连，就像复印机一样，只是把zerocool.Age的值拷贝给age了。而引用类型不一样，我们在声明guy的时候把anders赋给它，前面说过，引用类型包含的是只想堆上数据区域地址的引用，其实就是把anders的引用也赋给guy了，因此这二者从此指向了同一块内存区域，既然是指向同一块区域，那么甭管谁动了里面的“奶酪”，另一个变现出来的结果也会跟着变，就像信用卡跟亲情卡一样，用亲情卡取了钱，与之关联的信用卡账上也会跟着发生变化。一提到钱，估计大家伙儿印象就深了些吧，呵呵！</font></p>
<p><font size="2">另外，性能上也会有区别的。既然一个是直接操作内存，另一个则多一步先解析引用地址，那么显然很多时候值类型会减小系统性能开销。但“很多时候”不代表“所有时候”，有些时候还得量力而为，例如需要大量进行函数参数传递或返回的时候，老是这样进行字段拷贝，其实反而会降低应用程序性能。另外，如果实例会被频繁地用于Hashtable或者ArrayList之类的集合中，这些类会对其中的值类型变量进行装箱操作，这也会导致额外的内存分配和内存拷贝操作，从应用程序性能方面来看，其实也不划算。</font></p>
<p><font size="2">哦对了，上面提到了一个概念，装箱。那么什么是装箱呢？其实装箱就是值类型到引用类型的转化过程。将一个值类型变量装箱成一个引用类型变量，首先会在托管堆上为新的引用类型变量分配内存空间，然后将值类型变量拷贝到托管堆上新分配的对象内存中，最后返回新分配的对象内存地址。装箱操作是可逆的，所以还有拆箱操作。拆箱操作获取指向对象中包含值类型部分的指针，然后由程序员手动将其对应的值拷贝给值类型变量。接下来我们来看看典型的装箱和拆箱操作。</font></p>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">   1:</span> <span style="color: rgb(0, 0, 255);">public</span> <span style="color: rgb(0, 0, 255);">static</span> <span style="color: rgb(0, 0, 255);">class</span> BoxingAndUnboxing</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">   2:</span> {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">   3:</span>     <span style="color: rgb(0, 0, 255);">public</span> <span style="color: rgb(0, 0, 255);">static</span> <span style="color: rgb(0, 0, 255);">void</span> Demonstration()</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">   4:</span>     {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">   5:</span>         <span style="color: rgb(0, 0, 255);">int</span> ageInt = <span style="color: rgb(0, 0, 255);">new</span> <span style="color: rgb(0, 0, 255);">int</span>();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">   6:</span>&nbsp; </pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">   7:</span>         <span style="color: rgb(0, 128, 0);">// Boxing operation.</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">   8:</span>         <span style="color: rgb(0, 0, 255);">object</span> ageObject = ageInt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">   9:</span>&nbsp; </pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">  10:</span>         <span style="color: rgb(0, 128, 0);">//ageObject = null;</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">  11:</span>&nbsp; </pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">  12:</span>         <span style="color: rgb(0, 128, 0);">// Unboxing operation.</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">  13:</span>         ageInt = (<span style="color: rgb(0, 0, 255);">int</span>)ageObject;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">  14:</span>&nbsp; </pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">  15:</span>         Console.WriteLine(ageInt);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">  16:</span>     }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);">  17:</span> }</pre>
</div>
</div>
<p><font size="2">在该方法中，我们首先声明了一个值类型变量ageInt，但并未给它赋值，接着声明了一个典型的引用类型变量ageObject，并把ageInt赋给它，这里就进行了一次装箱操作。编译器现在托管堆上分配一块内存空间（空间大小为对象中包含的值类型变量所占空间总和外加一个方法表指针和一个SyncBlockIndex），然后把ageInt拷贝到这个空间中，再返回该空间的引用地址。接下来第13行则是拆箱操作，编译器获取到ageObject对象中值类型变量的指针，然后将其值拷贝给值类型变量。如果你把第10行注释掉的代码打开（这是通俗说法，其实就是取消注释），那么第13行就会抛出</font><a title="NullReferenceException Class" href="http://msdn2.microsoft.com/8w0s4024.aspx"><font size="2">System.NullReferenceException</font></a><font size="2">异常，要说问什么，这又会牵扯出值类型跟引用类型另一个大的不同。看见了吧，声明ageInt时并没有赋值，如果关掉第10行代码，程序不会报错，最后打印出个0，这说明在声明值类型变量时，如果没有初始化赋值，编译器会自动将其赋值为0，既然值类型没有引用，那么它就不可能为空。引用类型不一样，它可以为空引用，一张过期作废的银行卡是可以存在。而如果将一个空的对象拆箱，编译器上哪儿去找它里面的值类型变量的指针呢？所以这也是拆箱操作需要注意的地方。</font></p>
<p><font size="2">最后，我们在把值类型和引用类型之间其它一些明显区别大致罗列如下，以便大家能顺利通过面试第一问。</font></p>
<ul>
    <li><font size="2">所有值类型都继承自<a title="ValueType Class" href="http://msdn2.microsoft.com/aey3s293.aspx">System.ValueType</a>，但是ValueType没有附加<a title="Object Class" href="http://msdn2.microsoft.com/e5kfa45b.aspx">System.Object</a>包含之外其它任何方法，不过它倒是改写了Equals和GetHashCode两个方法。引用类型变量的Equals比较的是二者的引用地址而不是内部的值，值类型变量的Equals方法比较的是二者的值而不是……哦对了，值类型压根儿没有引用地址；</font></li>
    <li><font size="2">值类型不能作为其它任何类型的基类型，因此不能向值类型中增加任何新的虚方法，更不该有任何抽象方法，所有的方法都是sealed的（不可重写）；</font></li>
    <li><font size="2">未装箱的值类型分配在栈上而不是堆上，而栈又不是GC的地盘儿，因此GC根本不过问值类型变量的死活，一旦值类型变量的作用范围一过，它所占的内存空间就立即被回收掉，不劳GC亲自动手。</font> </li>
</ul>
<p><font size="2">以上罗列的都是值类型和引用类型之间的主要区别，文码并茂，相信应该给你留下比较深刻的印象，虽不够深，但愿能起到抛砖引玉的作用。如果去面SDE职位，估计这深度就差不多了，我这文章不是面向那些要去面Senior SDE甚至Dev Lead的正神，咱这儿庙小，嘿嘿！</font></p>
<p><img title="Money &amp; Gold" alt="Money &amp; Gold" src="moneygold_3.gif" border="0" height="357" width="500"></p>

<div id="digg_block">
<div id="div_digg">										
	<div class="diggit" onclick="DiggIt(1270685,28598,1)"> 
		<span class="diggnum" id="digg_count_1270685">0</span>
	</div>
	<div class="buryit" onclick="DiggIt(1270685,28598,2)"> 
		<span class="burynum" id="bury_count_1270685">0</span>
	</div>
	<div class="clear"></div>
	<span style="display: none;" id="span_isdigged_1270685">0</span>	
	<div class="diggword" id="digg_word_1270685">(请您对文章做出评价)</div>	
</div>
</div>
<div class="clear"></div>
<div id="post_next_prev">
<a href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270558.html">« </a> 上一篇：<a href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270558.html" title="发布于2008-08-18 18:28">序</a><br>
<a href="http://www.cnblogs.com/Autumoon/archive/2008/08/19/1271589.html">» </a> 下一篇：<a href="http://www.cnblogs.com/Autumoon/archive/2008/08/19/1271589.html" title="发布于2008-08-19 17:40">面向对象主要概念</a><br>
</div>








		</div>
		<div class="postDesc">posted @ 2008-08-18 23:23 <a href="http://www.cnblogs.com/Autumoon/">Autumoon</a> 阅读(3055) <a href="#commentform">评论(20)</a> &nbsp;<a href="http://www.cnblogs.com/Autumoon/admin/EditPosts.aspx?postid=1270685">编辑</a> <a href="http://www.cnblogs.com/Autumoon/AddToFavorite.aspx?id=1270685">收藏</a> <a href="#" onclick="PutInWz();return false;">网摘</a>  所属分类: <a href="http://www.cnblogs.com/Autumoon/category/151002.html">.NET程序员技术面试迷你手册（C#版）</a></div>
	</div>
	<img src="1270685.html" height="1" width="1">
	
<!--
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
<rdf:Description
rdf:about="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html"
dc:identifier="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html"
dc:title=""
trackback:ping="http://www.cnblogs.com/Autumoon/services/trackbacks/1270685.aspx" />
</rdf:RDF>
-->

</div><!--end: topics 文章、评论容器-->
<a name="pagedcomment"></a>
<!--done-->
<br>
<div class="feedback_area_title">发表评论</div>
<div class="feedbackNoItems"><span id="span_comment_maxid" style="display: none;">1298238</span></div>
	

		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("小眼睛老鼠",1290763,"0+1NnrlR96Asrfhr/lbsr6k9pOpvUzd0vC/yO+WWfG+2Bp2fx/toxw==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1290763,"0+1NnrlR96Asrfhr/lbsr6k9pOpvUzd0vC/yO+WWfG+2Bp2fx/toxw==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e5%b0%8f%e7%9c%bc%e7%9d%9b%e8%80%81%e9%bc%a0" target="_top">查看</a>&nbsp;&nbsp;&nbsp;&nbsp;
				</div>
				<a href="#1290763">#1楼</a><a name="1290763" id="comment_anchor_1290763"></a>2008-08-19 00:08 | <a id="Comments1_CommentList_ctl00_NameLink" href="http://www.cnblogs.com/clhed/" target="_top">小眼睛老鼠</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/%e5%b0%8f%e7%9c%bc%e7%9d%9b%e8%80%81%e9%bc%a0" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1290763" class="blog_comment_body"><a href="http://www.cnblogs.com/JimmyZhang/archive/2008/01/31/1059383.html" target="_new">http://www.cnblogs.com/JimmyZhang/archive/2008/01/31/1059383.html</a>
<br><br>楼主可以去看看这篇
<br><br>其实我觉得值类型和引用类型没什么讨论的必要
<br><br>在外观上仅仅是个名词的区别
<br><br>其外部体验区别是
<br><br>值传递和引用传递
<br><br>值比较和引用比较
<br><br>如果仅仅为了讨论值类型和引用类型区别
<br><br>而讨论值类型和引用类型很容易走到误区的
<br><br>如果把一系列全部一起讨论就会让人觉得豁然开朗了</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("Caling",1290785,"")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1290785,"")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">引用</a>&nbsp;&nbsp;&nbsp;&nbsp;
				</div>
				<a href="#1290785">#2楼</a><a name="1290785" id="comment_anchor_1290785"></a> 218.95.47.* 2008-08-19 01:04 | <a id="Comments1_CommentList_ctl01_NameLink" target="_blank">Caling[未注册用户]</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1290785" class="blog_comment_body">好错钱呀</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("U2U",1290790,"NwS8YqKECjkuvqUw00YBTa8O+s5dfd5duE0NhFpqJFRXtqE4eVx/yg==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1290790,"NwS8YqKECjkuvqUw00YBTa8O+s5dfd5duE0NhFpqJFRXtqE4eVx/yg==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=U2U" target="_top">查看</a>&nbsp;&nbsp;&nbsp;&nbsp;
				</div>
				<a href="#1290790">#3楼</a><a name="1290790" id="comment_anchor_1290790"></a>2008-08-19 01:28 | <a id="Comments1_CommentList_ctl02_NameLink" href="http://www.cnblogs.com/U2USoft/" target="_top">U2U</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/U2U" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1290790" class="blog_comment_body">我都不知道这个话题谈了又谈有什么意义，还使用各种形象生动的比喻，出发点是好，可是真的是~~~~~<br><br>不过我挺好奇的就是，，，你这样回答那过了没有 ，(*^__^*) 嘻嘻……</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("Autumoon",1290795,"M6sed0jREdUJvqEIDK6Tcwj6B9iFJq2qtJqYsoSPdqAKnXcYRqIo3A==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1290795,"M6sed0jREdUJvqEIDK6Tcwj6B9iFJq2qtJqYsoSPdqAKnXcYRqIo3A==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=Autumoon" target="_top">查看</a>&nbsp;&nbsp;&nbsp;&nbsp;
				</div>
				<a href="#1290795">#4楼</a><a name="1290795" id="comment_anchor_1290795"></a>[<span class="louzhu">楼主</span>]2008-08-19 01:49 | <a id="Comments1_CommentList_ctl03_NameLink" href="http://www.cnblogs.com/Autumoon/" target="_top">Autumoon</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/Autumoon" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1290795" class="blog_comment_body">请楼上各位先看看我这个系列的序言（<a href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270558.html" target="_new">http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270558.html</a>），你们以为我对这样的问题感兴趣呀，但是没办法，谁让这是当前面试的“主旋律”呢？被面试的人属于弱势群体，咱总不能遇到问这样问题的面试官就扯开嗓门地喊：“叫你们大堂经理出来，换人，丫面不了我”吧？哎，我也是出于无奈！</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("&amp;lt;∩扫地僧∩&amp;gt;",1290801,"1g9p7reBW2Z3iIvLZ2F4cwcbiZcxAg7alpi/AnldOvk2uiFKeZC67g==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1290801,"1g9p7reBW2Z3iIvLZ2F4cwcbiZcxAg7alpi/AnldOvk2uiFKeZC67g==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%26lt%3b%e2%88%a9%e6%89%ab%e5%9c%b0%e5%83%a7%e2%88%a9%26gt%3b" target="_top">查看</a>&nbsp;&nbsp;&nbsp;&nbsp;
				</div>
				<a href="#1290801">#5楼</a><a name="1290801" id="comment_anchor_1290801"></a>2008-08-19 02:10 | <a id="Comments1_CommentList_ctl04_NameLink" href="http://www.cnblogs.com/jinbinhan/" target="_top">&lt;∩扫地僧∩&gt;</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/%26lt%3b%e2%88%a9%e6%89%ab%e5%9c%b0%e5%83%a7%e2%88%a9%26gt%3b" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1290801" class="blog_comment_body">我觉得写得挺好！我喜欢！</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("小眼睛老鼠",1290803,"0+1NnrlR96Asrfhr/lbsr6k9pOpvUzd0vC/yO+WWfG+2Bp2fx/toxw==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1290803,"0+1NnrlR96Asrfhr/lbsr6k9pOpvUzd0vC/yO+WWfG+2Bp2fx/toxw==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e5%b0%8f%e7%9c%bc%e7%9d%9b%e8%80%81%e9%bc%a0" target="_top">查看</a>&nbsp;&nbsp;&nbsp;&nbsp;
				</div>
				<a href="#1290803">#6楼</a><a name="1290803" id="comment_anchor_1290803"></a>2008-08-19 02:28 | <a id="Comments1_CommentList_ctl05_NameLink" href="http://www.cnblogs.com/clhed/" target="_top">小眼睛老鼠</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/%e5%b0%8f%e7%9c%bc%e7%9d%9b%e8%80%81%e9%bc%a0" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1290803" class="blog_comment_body">@Autumoon
<br><br>。。。没说你什么写的不好
<br><br>我记得当时特别困扰我的一个问题就是string
<br><br>这个特殊的对象
<br><br>属于引用类型
<br><br>一般来说引用型用 ==（值比较）
<br><br>比较应该是false的
<br><br>但是事实上string就可以用==做比较（做的是值比较）
<br><br>而如果是值比较那么string传递的是什么呢？
<br><br>是值传递还是引用传递？？
<br><br>这个问题困扰了我久（完全新人的时候）
<br><br>所以我认为单纯讲引用类型和值类型是误导人
<br><br>需要把一些特殊的情况也写进来
<br><br>
<br><br>所以我对上面仅仅是对这个文章的建议而已
<br><br>也许是我没有看过阁下的系列的原因
<br><br>评论过激了 我道歉就是了
<br>希望阁下不要介意</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("Desmend",1290851,"OfPa28gIMuMzWxoMMVTxcrMgnrZRAtlFhEjKpm0oeS+ELCedyLmvtg==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1290851,"OfPa28gIMuMzWxoMMVTxcrMgnrZRAtlFhEjKpm0oeS+ELCedyLmvtg==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=Desmend" target="_top">查看</a>&nbsp;&nbsp;&nbsp;&nbsp;
				</div>
				<a href="#1290851">#7楼</a><a name="1290851" id="comment_anchor_1290851"></a>2008-08-19 08:35 | <a id="Comments1_CommentList_ctl06_NameLink" href="http://www.cnblogs.com/desmend/" target="_top">Desmend</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/Desmend" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1290851" class="blog_comment_body">感觉 还是写的不错</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("liyundong",1290857,"1w3NX2wbJNErbW9GSQasPkzMjCfYZ2ubQUzD/0OeHyIzZsmUhq/VUg==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1290857,"1w3NX2wbJNErbW9GSQasPkzMjCfYZ2ubQUzD/0OeHyIzZsmUhq/VUg==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=liyundong" target="_top">查看</a>&nbsp;&nbsp;&nbsp;&nbsp;
				</div>
				<a href="#1290857">#8楼</a><a name="1290857" id="comment_anchor_1290857"></a>2008-08-19 08:45 | <a id="Comments1_CommentList_ctl07_NameLink" href="http://www.cnblogs.com/liyundong/" target="_top">liyundong</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/liyundong" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1290857" class="blog_comment_body">写的真不错，很具体形象，可以去当老师了。呵呵。
<br>期待楼主更多的共享。</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("Eric zhou",1290864,"BeNbaIH3KiPMJbfGF0O9lhUO66Ji2ZiZc6P2CFrw069p+u1xxqi8NA==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1290864,"BeNbaIH3KiPMJbfGF0O9lhUO66Ji2ZiZc6P2CFrw069p+u1xxqi8NA==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=Eric+zhou" target="_top">查看</a>&nbsp;&nbsp;&nbsp;&nbsp;
				</div>
				<a href="#1290864">#9楼</a><a name="1290864" id="comment_anchor_1290864"></a>2008-08-19 08:49 | <a id="Comments1_CommentList_ctl08_NameLink" href="http://www.cnblogs.com/tianqing/" target="_top">Eric zhou</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/Eric+zhou" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1290864" class="blog_comment_body">支持</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("Autumoon",1290900,"M6sed0jREdUJvqEIDK6Tcwj6B9iFJq2qtJqYsoSPdqAKnXcYRqIo3A==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1290900,"M6sed0jREdUJvqEIDK6Tcwj6B9iFJq2qtJqYsoSPdqAKnXcYRqIo3A==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=Autumoon" target="_top">查看</a>&nbsp;&nbsp;&nbsp;&nbsp;
				</div>
				<a href="#1290900">#10楼</a><a name="1290900" id="comment_anchor_1290900"></a>[<span class="louzhu">楼主</span>]2008-08-19 09:07 | <a id="Comments1_CommentList_ctl09_NameLink" href="http://www.cnblogs.com/Autumoon/" target="_top">Autumoon</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/Autumoon" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1290900" class="blog_comment_body">@小眼睛老鼠
<br>
<br>string的确是很特殊的引用类型，昨晚我写的时候也想着要写进去，但是我觉得我对string的特殊之处还没把握太完全，所以没好擅自写进去，要不我在后面另外专门加一篇吧，您客气了，谢谢！</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("陈晨",1290904,"TMAoIwCAJPHGEKB3It88EImsinkw1T3pXLhkbKBavjo6Nuzy/DSdLQ==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1290904,"TMAoIwCAJPHGEKB3It88EImsinkw1T3pXLhkbKBavjo6Nuzy/DSdLQ==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e9%99%88%e6%99%a8" target="_top">查看</a>&nbsp;&nbsp;&nbsp;&nbsp;
				</div>
				<a href="#1290904">#11楼</a><a name="1290904" id="comment_anchor_1290904"></a>2008-08-19 09:09 | <a id="Comments1_CommentList_ctl10_NameLink" href="http://www.cnblogs.com/freshman0216/" target="_top">陈晨</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/%e9%99%88%e6%99%a8" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1290904" class="blog_comment_body">不错，把遇到的问题总结出来
<br>对自己来说是一种提高，对别人来说是一种分享
<br>并不一定别人写过的就不能写，每个人都有不同的认识
<br></span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("左手打酱油，右手俯卧撑",1291054,"")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1291054,"")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">引用</a>&nbsp;&nbsp;&nbsp;&nbsp;
				</div>
				<a href="#1291054">#12楼</a><a name="1291054" id="comment_anchor_1291054"></a> 207.46.92.* 2008-08-19 10:27 | <a id="Comments1_CommentList_ctl11_NameLink" target="_blank">左手打酱油，右手俯卧撑[未注册用户]</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1291054" class="blog_comment_body">偶也，string在于immutability，内存上它在堆上，使用上又像值。具体实现有个哈希运算，哪位大侠知道这个哈希实现机制的在下想请教，谢谢</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("liugq",1291096,"")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1291096,"")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">引用</a>&nbsp;&nbsp;&nbsp;&nbsp;
				</div>
				<a href="#1291096">#13楼</a><a name="1291096" id="comment_anchor_1291096"></a> 219.146.83.* 2008-08-19 10:56 | <a id="Comments1_CommentList_ctl12_NameLink" target="_blank">liugq[未注册用户]</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1291096" class="blog_comment_body">String 做了操作符的重载。<br>public static bool operator ==(string a, string b)<br>{<br>    return Equals(a, b);<br>}<br>public static bool operator !=(string a, string b)<br>{<br>    return !Equals(a, b);<br>}<br><br> <br><br> <br><br> <br></span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("shaofeic",1291319,"")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1291319,"")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">引用</a>&nbsp;&nbsp;&nbsp;&nbsp;
				</div>
				<a href="#1291319">#14楼</a><a name="1291319" id="comment_anchor_1291319"></a> 207.46.92.* 2008-08-19 14:09 | <a id="Comments1_CommentList_ctl13_NameLink" target="_blank">shaofeic[未注册用户]</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1291319" class="blog_comment_body">纠正一点 引用类型和值类型跟堆区和栈区没有必然联系
<br>
<br>C++只能用指针/引用去访问堆 可能是这个误导了你的思路
<br></span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("Autumoon",1291348,"M6sed0jREdUJvqEIDK6Tcwj6B9iFJq2qtJqYsoSPdqAKnXcYRqIo3A==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1291348,"M6sed0jREdUJvqEIDK6Tcwj6B9iFJq2qtJqYsoSPdqAKnXcYRqIo3A==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=Autumoon" target="_top">查看</a>&nbsp;&nbsp;&nbsp;&nbsp;
				</div>
				<a href="#1291348">#15楼</a><a name="1291348" id="comment_anchor_1291348"></a>[<span class="louzhu">楼主</span>]2008-08-19 14:31 | <a id="Comments1_CommentList_ctl14_NameLink" href="http://www.cnblogs.com/Autumoon/" target="_top">Autumoon</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/Autumoon" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1291348" class="blog_comment_body">@shaofeic
<br><br>
<br>值类型对象分配在栈上，引用类型对象分配在堆上，怎么能说没有必然联系呢？</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("懒得起名",1291562,"Pdws61x+NQ8fl9ARVs6LtT41joO9lQvJKu4mLDCcM+c3p9gdc2mSCQ==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1291562,"Pdws61x+NQ8fl9ARVs6LtT41joO9lQvJKu4mLDCcM+c3p9gdc2mSCQ==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e6%87%92%e5%be%97%e8%b5%b7%e5%90%8d" target="_top">查看</a>&nbsp;&nbsp;&nbsp;&nbsp;
				</div>
				<a href="#1291562">#16楼</a><a name="1291562" id="comment_anchor_1291562"></a>2008-08-19 17:13 | <a id="Comments1_CommentList_ctl15_NameLink" href="http://www.cnblogs.com/winter-cn/" target="_top">懒得起名</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/%e6%87%92%e5%be%97%e8%b5%b7%e5%90%8d" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1291562" class="blog_comment_body">@Autumoon
<br>Hi, I'm shaofeic.
<br>
<br>"值类型对象分配在栈上，引用类型对象分配在堆上"
<br>我的意思是根本没有这种事
<br>
<br>引用类型和值类型是程序中的变量和内存中对象的关系与内存区域划分无关
<br>
<br>一个显著的例子就是C++的placement new 你可以搜搜看
<br>另一个例子是 JavaScript中 值类型也分配在heap中
<br>
<br>另外 字符串大部分是引用类型的 字符串常量通常出现在静态内存区中（这更加与stack和heap无关了吧） 但具体是依赖不同语言的不同实现的
<br>
<br>至于运算符的问题 其实是不准确的 不同语言会按不同方式定义运算符 比如JS中甚至有2种比较运算符==和=== C#/C++中则允许重载==</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("Autumoon",1291612,"M6sed0jREdUJvqEIDK6Tcwj6B9iFJq2qtJqYsoSPdqAKnXcYRqIo3A==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1291612,"M6sed0jREdUJvqEIDK6Tcwj6B9iFJq2qtJqYsoSPdqAKnXcYRqIo3A==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=Autumoon" target="_top">查看</a>&nbsp;&nbsp;&nbsp;&nbsp;
				</div>
				<a href="#1291612">#17楼</a><a name="1291612" id="comment_anchor_1291612"></a>[<span class="louzhu">楼主</span>]2008-08-19 17:47 | <a id="Comments1_CommentList_ctl16_NameLink" href="http://www.cnblogs.com/Autumoon/" target="_top">Autumoon</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/Autumoon" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1291612" class="blog_comment_body">@懒得起名
<br>
<br>你好，非常感谢你的热心！我想声明的一点是，这篇文章不是孤立的，而是《.NET程序员技术面试迷你手册（C#版）》（<a href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270520.html" target="_new">http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270520.html</a>）系列中的一篇，主要是面向那些需要面试.NET开发工程师的朋友，探讨的也主要是.NET Framework的机制，我不太清楚你是不是没把这个前提了解清楚，呵呵，请注意本文最开头的“回目录”链接。</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("懒得起名",1291673,"Pdws61x+NQ8fl9ARVs6LtT41joO9lQvJKu4mLDCcM+c3p9gdc2mSCQ==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1291673,"Pdws61x+NQ8fl9ARVs6LtT41joO9lQvJKu4mLDCcM+c3p9gdc2mSCQ==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e6%87%92%e5%be%97%e8%b5%b7%e5%90%8d" target="_top">查看</a>&nbsp;&nbsp;&nbsp;&nbsp;
				</div>
				<a href="#1291673">#18楼</a><a name="1291673" id="comment_anchor_1291673"></a>2008-08-19 19:41 | <a id="Comments1_CommentList_ctl17_NameLink" href="http://www.cnblogs.com/winter-cn/" target="_top">懒得起名</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/%e6%87%92%e5%be%97%e8%b5%b7%e5%90%8d" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1291673" class="blog_comment_body">@Autumoon
<br>
<br>C#的new确实总是在heap上分配内存 而且是返回引用型对象 但不代表引用型对象跟heap有什么特别的关系 比如C#也支持unsafe的代码
<br>
<br>关键是这是一个概念错误 内存区域和值/引用是两个层次的东西 不能因为C#的new这么做就把他们联系在一起</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("韩现龙",1291919,"GSGjIORxfUVYMHDZACRiT5w87OeHNuwbku8caUOD6HF0L2ONGUeSYA==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1291919,"GSGjIORxfUVYMHDZACRiT5w87OeHNuwbku8caUOD6HF0L2ONGUeSYA==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e9%9f%a9%e7%8e%b0%e9%be%99" target="_top">查看</a>&nbsp;&nbsp;&nbsp;&nbsp;
				</div>
				<a href="#1291919">#19楼</a><a name="1291919" id="comment_anchor_1291919"></a>2008-08-20 08:42 | <a id="Comments1_CommentList_ctl18_NameLink" href="http://www.cnblogs.com/hanxianlong/" target="_top">韩现龙</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/%e9%9f%a9%e7%8e%b0%e9%be%99" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1291919" class="blog_comment_body">总结得不错.anytao在他的&lt;你必须知道的.NET&gt;已经对值类型和引用类型的区别说的很清楚了,包括上面那位仁兄提到的string问题</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("maxthon",1298238,"pqfrwWY4hB4kiKRxA4DnZ1lzuimGD3l7sigqzTpS+dyYemRtiz/T3Q==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1298238,"pqfrwWY4hB4kiKRxA4DnZ1lzuimGD3l7sigqzTpS+dyYemRtiz/T3Q==")' href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=maxthon" target="_top">查看</a>&nbsp;&nbsp;&nbsp;&nbsp;
				</div>
				<a href="#1298238">#20楼</a><a name="1298238" id="comment_anchor_1298238"></a><a name="Post"></a>2008-08-26 16:20 | <a id="Comments1_CommentList_ctl19_NameLink" href="http://www.cnblogs.com/cntour365/" target="_top">maxthon</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/maxthon" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1298238" class="blog_comment_body">好，收藏了</span><br>
			</div>
		</div>
	

<div id="comment_form" class="commentform">



<div id="divCommentShow"></div>
<div id="comment_nav" style="text-align: right;"><span id="span_refresh_tips"></span><a href="###" onclick="return RefreshCommentList(1270685);" name="commentform" id="lnk_RefreshComments">刷新评论列表</a>&nbsp; <a href="###" onclick="return RefreshPage();">刷新页面</a>&nbsp; <a href="#top">返回页首</a></div>
<div id="commentform_title">发表评论 <span class="ad_commentbox_up"><a href="http://www.cnblogs.com/" target="_top">博客园首页</a>&nbsp; <a href="http://news.cnblogs.com/" target="_top">IT新闻</a>&nbsp; <a href="http://home.cnblogs.com/ing/" target="_top">闪存</a>&nbsp; <a href="http://job.cnblogs.com/" target="_top">招聘</a>&nbsp; <a href="http://a4.yeshj.com/rd/34143/" target="_top">学英语</a></span></div>
<span id="tip_comment" style="color: Red;"></span>
<p>
昵称：<input name="ctl05$tbCommentAuthor" id="ctl05_tbCommentAuthor" class="author" value="解然" disabled="disabled" type="text">
</p>
<p>
主页：<input name="ctl05$tbCommentAuthorUrl" id="ctl05_tbCommentAuthorUrl" class="url" value="http://www.cnblogs.com/xieran/" disabled="disabled" type="text">
</p>
<p>
</p><div class="commentbox_title">
<div class="commentbox_title_left">评论内容：</div>
<div class="commentbox_title_right">
<img id="ubb_quote" class="comment_icon" src="quote.gif" alt="引用" title="添加引用" onclick="insertUBB('tbCommentBody','quote')">
<img id="ubb_bold" class="comment_icon" src="b.png" alt="粗体" title="添加粗体" onclick="insertUBB('tbCommentBody','b')">
<img id="ubb_url" class="comment_icon" src="lk.png" alt="链接" title="添加链接" onclick="insertUbbUrl('tbCommentBody')">
<img id="ubb_indent" class="comment_icon" src="indent.png" alt="缩进" title="添加首行缩进" onclick="insertIndent('tbCommentBody')">
<img id="ubb_img" class="comment_icon" src="img.gif" alt="图片" title="添加图片" onclick="insertUbbImg('tbCommentBody')">
<img id="ubb_code" class="comment_icon" style="" src="insertcode.gif" alt="代码" title="添加代码" onclick="insertUbbCode()">
</div>
</div>
<div class="clear"></div>
<textarea id="tbCommentBody" class="comment_textarea" onkeydown="return clt_enter(event)"></textarea>

<p>
<input id="btn_comment_submit" class="comment_btn" value="提交" onclick="PostComment();return false;" type="button">
&nbsp;&nbsp;<span id="span_comment_canceledit" style="display: none;"><a href="###" onclick="return CancelCommentEdit()">不改了</a>&nbsp;&nbsp;</span><a href="http://passport.cnblogs.com/logout.aspx?ReturnUrl=http%3a%2f%2fwww.cnblogs.com%2fAutumoon%2farchive%2f2008%2f08%2f18%2f1270685.html%3flogout%3d1%23commentform" onclick="return confirm('确认注销吗？')">注销</a>&nbsp;&nbsp;<a id="ctl05_lnkSubscribe" title="邮件订阅回复通知" onclick="return SubscribeComment();" href="http://www.cnblogs.com/UI/Controls/#%23%23">订阅回复</a>
</p>
<p>
[使用Ctrl+Enter键快速提交]
</p>
<div style="display: none;">
<span id="comment_edit_id"></span><span id="span_parentcomment_id">0</span>
<span id="span_parent_id">1270685</span>
<span id="span_comment_replyto"></span>
<span id="span_comment_title">值类型和引用类型的区别</span>
<span id="span_comment_posted"></span>
</div>

<div class="itnews c_ad_block" id="itnews">
<a href="http://news.cnblogs.com/" target="_top">IT新闻</a>:<br>

          ·  <a href="http://news.cnblogs.com/n/55140/" target="_top">《星际争霸2》"刀锋女王"重金属主题音乐视频</a><br>
	
          ·  <a href="http://news.cnblogs.com/n/55139/" target="_top">中国站长最郁闷的几件事情</a><br>
	
          ·  <a href="http://news.cnblogs.com/n/55138/" target="_top">苹果Vs谷歌：手机领域谁怕谁？</a><br>
	
          ·  <a href="http://news.cnblogs.com/n/55137/" target="_top">摩托罗拉：豪赌Android的希望与隐忧</a><br>
	
          ·  <a href="http://news.cnblogs.com/n/55136/" target="_top">分众新坐标：楼宇是过去 未来在手机和互联网</a><br>
	
</div>


<div id="ad_under_comment" class="c_ad_block">
<a href="http://a4.yeshj.com/rd/34138/" target="_top">每天10分钟，轻松学英语</a><br><br>
<div id="google_ads_div_cnblogs_blogpost_bottom1">
<iframe src="index_1.html" style="border: 0pt none ;" marginheight="0" marginwidth="0" name="google_ads_iframe_cnblogs_blogpost_bottom1" id="google_ads_iframe_cnblogs_blogpost_bottom1" scrolling="no" frameborder="0" height="60" width="468"></iframe></div>

<br>
<div id="google_ads_div_cnblogs_blogpost_bottom">
<iframe src="index_2.html" style="border: 0pt none ;" marginheight="0" marginwidth="0" name="google_ads_iframe_cnblogs_blogpost_bottom" id="google_ads_iframe_cnblogs_blogpost_bottom" scrolling="no" frameborder="0" height="250" width="300"></iframe></div>

</div>
<div id="site_nav_under" class="c_ad_block">
网站导航：<br>
<a href="http://www.cnblogs.com/" target="_top">博客园首页</a> &nbsp;<a href="http://news.cnblogs.com/" target="_top">IT新闻</a> &nbsp;<a href="http://home.cnblogs.com/" target="_top">个人主页</a> &nbsp;<a href="http://home.cnblogs.com/ing/" target="_top">闪存</a> &nbsp;<a href="http://job.cnblogs.com/" target="_top">程序员招聘</a> &nbsp;<a href="http://space.cnblogs.com/" target="_top">社区</a> &nbsp;<a href="http://space.cnblogs.com/q/" target="_top">博问</a> &nbsp;<a href="http://wz.cnblogs.com/" target="_top">网摘</a>
</div>
<div id="ad_under_comment2" class="c_ad_block">
<a href="http://www.china-pub.com/STATIC07/0912/zh_ndcx_091212.asp" target="_top"><img src="chinapub_20091222.jpg" alt="" style="border: 0px none ;"></a><br>
<a href="http://www.china-pub.com/itbook/" target="_top">China-pub 计算机图书网上专卖店！6.5万品种2-8折！</a><br>
<a href="http://www.china-pub.com/static07/0901/zh_jueba_090121.asp" target="_top">China-Pub 计算机绝版图书按需印刷服务</a><br>
</div>


<div id="div_commentbox_nav" class="c_ad_block">
链接：<a href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html?switchskin=1#skinlist">切换模板</a><br>
</div>
<div id="relative_search"><br><b>相关搜索:</b><br> <a href="http://zzk.cnblogs.com/s?w=.NET%e7%a8%8b%e5%ba%8f%e5%91%98%e6%8a%80%e6%9c%af%e9%9d%a2%e8%af%95%e8%bf%b7%e4%bd%a0%e6%89%8b%e5%86%8c%ef%bc%88C%23%e7%89%88%ef%bc%89" target="_top">.NET程序员技术面试迷你手册（C#版）</a> </div><div id="relative_search"><br><b>在知识库中查看：</b><br> <a href="http://kb.cnblogs.com/a/1270685/">值类型和引用类型的区别</a></div>

</div>




				
	</div><!--end: forFlow -->
	</div><!--end: mainContent 主体内容容器-->

	<div id="sideBar">
		<div id="sideBarMain">
			
<!--done-->
<div class="newsItem">
<h3 class="catListTitle">公告</h3>
	<p align="center"><embed src="world001-blue.swf" type="application/x-shockwave-flash" wmode="transparent" height="92" width="175"><br>
<br>
Since&nbsp;May 31, 1998.<br><!--<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#88;&#105;&#110;&#119;&#101;&#110;&#67;&#104;&#101;&#110;&#103;&#64;&#103;&#109;&#97;&#105;&#108;&#46;&#99;&#111;&#109;"><img height=21 alt="" src="http://images.cnblogs.com/cnblogs_com/zerocool/MyGmailLink.png" width=175 border=0 /></a><br/><br/>--><img src="r_mvp.png" alt="MVP (Visual C#)"><br><br></p><div style=""><table style="" cellpadding="4" cellspacing="0"><tbody><tr align="center"><td style=""><a href="http://www.douban.com/subject/1136852/" title="南怀瑾选集（第三卷）" target="_top"><img src="s2177899.jpg" border="0"></a></td><td style=""><a href="http://www.douban.com/subject/1477390/" title="代码大全（第2版）" target="_top"><img src="s1495029.jpg" border="0"></a></td></tr><tr align="center"><td style=""><a href="http://www.douban.com/subject/3883231/" title="Pro Silverlight 3 in C#" target="_top"><img src="s3900991.jpg" border="0"></a></td><td style=""><a href="http://www.douban.com/subject/1085660/" title="尽管去做

Getting Things Done The Art of Stress-free Productivity" target="_top"><img src="s1796471.jpg" border="0"></a></td></tr><tr align="center"><td style=""><a href="http://www.douban.com/subject/3696561/" title="世界又热又平又挤" target="_top"><img src="s3763074.jpg" border="0"></a></td></tr><tr><td colspan="2" align="center"><a href="http://www.douban.com/people/XinwenCheng/" target="_top">我的豆瓣主页</a></td></tr></tbody></table></div><br><div id="profile_block"><a href="http://home.cnblogs.com/Autumoon/" target="_top">我的主页</a>&nbsp; <a href="http://home.cnblogs.com/Autumoon/detail/" target="_top">个人资料</a><br><a href="http://home.cnblogs.com/Autumoon/ing/" target="_top">我的闪存</a>&nbsp; <a href="http://space.cnblogs.com/msg/send/Autumoon" target="_top">发短消息</a></div>
</div>

			<div id="calendar"></div>
			
			<div id="leftcontentcontainer">
				
<div class="catListPostCategory">
<h3 class="catListTitle">随笔分类<span style="font-size: 11px; font-weight: normal;">(69)</span></h3>

<ul>

<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl01_Link" href="http://www.cnblogs.com/Autumoon/category/151002.html">.NET程序员技术面试迷你手册（C#版）(5)</a> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl01_RssLink" title="Subscribe to .NET程序员技术面试迷你手册（C#版）(5)" href="http://www.cnblogs.com/Autumoon/category/151002.html/rss">(rss)</a></li>

<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl02_Link" href="http://www.cnblogs.com/Autumoon/category/102693.html">Autumoon Code Library(1)</a> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl02_RssLink" title="Subscribe to Autumoon Code Library(1)" href="http://www.cnblogs.com/Autumoon/category/102693.html/rss">(rss)</a></li>

<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl03_Link" href="http://www.cnblogs.com/Autumoon/category/112473.html">C# 3.0 探索之旅(9)</a> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl03_RssLink" title="Subscribe to C# 3.0 探索之旅(9)" href="http://www.cnblogs.com/Autumoon/category/112473.html/rss">(rss)</a></li>

<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl04_Link" href="http://www.cnblogs.com/Autumoon/category/113499.html">LINQ 探索之旅(5)</a> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl04_RssLink" title="Subscribe to LINQ 探索之旅(5)" href="http://www.cnblogs.com/Autumoon/category/113499.html/rss">(rss)</a></li>

<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl05_Link" href="http://www.cnblogs.com/Autumoon/category/158314.html">Office Live for Small Business(4)</a> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl05_RssLink" title="Subscribe to Office Live for Small Business(4)" href="http://www.cnblogs.com/Autumoon/category/158314.html/rss">(rss)</a></li>

<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl06_Link" href="http://www.cnblogs.com/Autumoon/category/131874.html">白话C#系列(8)</a> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl06_RssLink" title="Subscribe to 白话C#系列(8)" href="http://www.cnblogs.com/Autumoon/category/131874.html/rss">(rss)</a></li>

<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl07_Link" href="http://www.cnblogs.com/Autumoon/category/221050.html">读书笔记(1)</a> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl07_RssLink" title="Subscribe to 读书笔记(1)" href="http://www.cnblogs.com/Autumoon/category/221050.html/rss">(rss)</a></li>

<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl08_Link" href="http://www.cnblogs.com/Autumoon/category/141025.html">多普达 Touch Diamond 创新前沿体验(4)</a> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl08_RssLink" title="Subscribe to 多普达 Touch Diamond 创新前沿体验(4)" href="http://www.cnblogs.com/Autumoon/category/141025.html/rss">(rss)</a></li>

<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl09_Link" href="http://www.cnblogs.com/Autumoon/category/102692.html">公告(2)</a> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl09_RssLink" title="Subscribe to 公告(2)" href="http://www.cnblogs.com/Autumoon/category/102692.html/rss">(rss)</a></li>

<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl10_Link" href="http://www.cnblogs.com/Autumoon/category/102688.html">技术杂文(3)</a> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl10_RssLink" title="Subscribe to 技术杂文(3)" href="http://www.cnblogs.com/Autumoon/category/102688.html/rss">(rss)</a></li>

<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl11_Link" href="http://www.cnblogs.com/Autumoon/category/114802.html">简明设计模式——C#版(25)</a> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl11_RssLink" title="Subscribe to 简明设计模式——C#版(25)" href="http://www.cnblogs.com/Autumoon/category/114802.html/rss">(rss)</a></li>

<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl12_Link" href="http://www.cnblogs.com/Autumoon/category/228064.html">时间管理(2)</a> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl12_RssLink" title="Subscribe to 时间管理(2)" href="http://www.cnblogs.com/Autumoon/category/228064.html/rss">(rss)</a></li>

</ul>

</div>

<div class="catList">
<h3 class="catListTitle">友情链接</h3>

<ul>

<li><a id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl01_Link" href="http://www.codeplex.com/site/users/view/Autumoon" target="_top">Autumoon @ CodePlex</a> </li>

<li><a id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl02_Link" href="http://zerocool.cnblogs.com/" target="_top">作者博客</a> <a id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl02_RssLink" title="Subscribe to 作者博客" href="http://www.cnblogs.com/ZeroCool/rss">(rss)</a></li>
<li style="margin-top: 2px;">/* ZeroCool的个人博客 */</li>
</ul>

</div>



<div class="catListComment">
<h3 class="catListTitle">最新评论<a id="SingleColumn1__3514896_RSSHyperlink1" title="RSS订阅最最新评论" href="http://www.cnblogs.com/Autumoon/CommentsRSS.aspx"><img title="RSS订阅最最新评论" src="xml.gif" style="border-width: 0px;"></a></h3>

	
			<div class="divRecentCommentAticle">
				<a id="SingleColumn1__3514896_CommentList_ctl00_Hyperlink2" class="listitem" href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270558.html#1748817">1.&nbsp;Re:序</a>
			</div>
			<div class="divRecentComment">
				基础的东西很重要，往往出的Bug都是这些导致的，其实软件开发最重要的思想，单基础概念同样不可忽视。 (寒枫)
			</div>		
		
			<div class="divRecentCommentAticle">
				<a id="SingleColumn1__3514896_CommentList_ctl01_Hyperlink2" class="listitem" href="http://www.cnblogs.com/Autumoon/archive/2010/01/17/1649909.html#1748760">2.&nbsp;Re:把时间管理培养成习惯</a>
			</div>
			<div class="divRecentComment">
				nice article (王德水)
			</div>		
		
			<div class="divRecentCommentAticle">
				<a id="SingleColumn1__3514896_CommentList_ctl02_Hyperlink2" class="listitem" href="http://www.cnblogs.com/Autumoon/archive/2010/01/17/1649909.html#1748755">3.&nbsp;Re:把时间管理培养成习惯</a>
			</div>
			<div class="divRecentComment">
				地板，呵！道理浅显易懂，但很少人会这样进行时间管理，往往是做事前稍微考虑一下。养成好的习惯的确很重要。 (GoodGF)
			</div>		
		
			<div class="divRecentCommentAticle">
				<a id="SingleColumn1__3514896_CommentList_ctl03_Hyperlink2" class="listitem" href="http://www.cnblogs.com/Autumoon/archive/2010/01/17/1649909.html#1748728">4.&nbsp;Re:把时间管理培养成习惯</a>
			</div>
			<div class="divRecentComment">
				好文章 (长河落日)
			</div>		
		
			<div class="divRecentCommentAticle">
				<a id="SingleColumn1__3514896_CommentList_ctl04_Hyperlink2" class="listitem" href="http://www.cnblogs.com/Autumoon/archive/2010/01/09/1642846.html#1743368">5.&nbsp;Re:时间管理——被忽视的重要理念！</a>
			</div>
			<div class="divRecentComment">
				管理时间最有效的方法，就是建立良好的生活规律！

当我们手中握有大把的时间时，效率却不一定高；反之，在挤出的时间里，恰恰相反！
 (卡通一下)
			</div>		
		
</div>

<div class="catListView">
<h3 class="catListTitle">阅读排行榜</h3>
	
			<ul>
		
			<li>
				<a id="SingleColumn1_ctl02_TopList_ctl01_Hyperlink1" href="http://www.cnblogs.com/Autumoon/archive/2008/06/19/1225684.html">1.&nbsp;多线程(5900)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl02_TopList_ctl02_Hyperlink1" href="http://www.cnblogs.com/Autumoon/archive/2008/08/19/1271589.html">2.&nbsp;面向对象主要概念(3461)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl02_TopList_ctl03_Hyperlink1" href="http://www.cnblogs.com/Autumoon/archive/2008/06/23/1228335.html">3.&nbsp;反射(3172)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl02_TopList_ctl04_Hyperlink1" href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html">4.&nbsp;值类型和引用类型的区别(3055)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl02_TopList_ctl05_Hyperlink1" href="http://www.cnblogs.com/Autumoon/archive/2008/07/01/1233476.html">5.&nbsp;Touch Diamond Remote —— 世界就在指尖(2898)</a>
			</li>
		
			</ul>
		
</div>

<div class="catListFeedback">
<h3 class="catListTitle">评论排行榜</h3>
	
			<ul>
		
			<li>
				<a id="SingleColumn1_ctl03_TopList_ctl01_Hyperlink1" href="http://www.cnblogs.com/Autumoon/archive/2008/07/01/1233476.html">1.&nbsp;Touch Diamond Remote —— 世界就在指尖(38)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl03_TopList_ctl02_Hyperlink1" href="http://www.cnblogs.com/Autumoon/archive/2008/06/19/1225684.html">2.&nbsp;多线程(35)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl03_TopList_ctl03_Hyperlink1" href="http://www.cnblogs.com/Autumoon/archive/2008/08/19/1271589.html">3.&nbsp;面向对象主要概念(26)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl03_TopList_ctl04_Hyperlink1" href="http://www.cnblogs.com/Autumoon/archive/2008/08/26/1276746.html">4.&nbsp;寻找失落的SubString(23)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl03_TopList_ctl05_Hyperlink1" href="http://www.cnblogs.com/Autumoon/archive/2008/08/18/1270685.html">5.&nbsp;值类型和引用类型的区别(20)</a>
			</li>
		
			</ul>
		
</div>

				
<div id="blog_ad_google">
<h3>Google广告</h3>
<ul>
<li>

<ins style="border: medium none ; margin: 0pt; padding: 0pt; display: inline-table; height: 250px; position: relative; visibility: visible; width: 300px;"><ins style="border: medium none ; margin: 0pt; padding: 0pt; display: block; height: 250px; position: relative; visibility: visible; width: 300px;"><iframe allowtransparency="true" hspace="0" id="google_ads_frame3" marginheight="0" marginwidth="0" name="google_ads_frame" src="index_3.html" style="left: 0pt; position: absolute; top: 0pt;" vspace="0" scrolling="no" frameborder="0" height="250" width="300"></iframe></ins></ins>
</li>
</ul>
</div>
			</div>
			
		</div><!--end: sideBarMain -->
	</div><!--end: sideBar 侧边栏容器 -->
	<div class="clear"></div>
	</div><!--end: main -->
	<div class="clear"></div>
	<div id="footer">
		
<!--done-->
Copyright ©2010 Autumoon
	</div><!--end: footer -->
</div><!--end: home 自定义的最大容器 -->
    </form>
	
	
      
    
    
    
</body>
</html>
